Design patterns & OO

I have the feeling that design patterns and not restricted to OO

I'll try to make a convincing argument by iterating through well-known patterns and see how they can be applied in functionnal orientated code or how the problems that these patterns try to solve do not arise in the functional style

I'm using refactoring.guru as a list of patterns to iterate through and their examples as starting points for mines

#! TODO !

Creational Design Patterns

Factory

The problem here arises when we have two logistics class that each implement a createTransport() method

Each method returns a different class instance that is used by the logistic class

The proposed OO solution is to create an interface from which the createTransport() return values will inherit so that the logistic may be abstracted over the said interface called Transport in this case

Here is the code for the FP problem and solution


Abstact

Builder

Prototype

Singleton

Structural Design Patterns

Behavioral Design Patterns

XXIIVV webring